/*
 * Copyright (c) 2025, 大连理工大学 (Dalian University of Technology)
 *
 * Licensed under the Mulan PSL v2.
 * You can use this file according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of the License at
 *
 *     http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. SEE THE MULAN PSL v2
 * FOR MORE DETAILS.
 */

/*
 * @Author: qiulin_JXGM ql1746365080@gmail.com
 * @Date: 2024-09-03 13:42:42
 * @LastEditors: wxc superjava@qq.com
 * @LastEditTime: 2024-09-29 13:09:22
 * @FilePath: /SGFEM/DBManager/DBManager/Repository/HDF5/Input/Property/PBEAMRepository.h"
 */

#pragma once

#include <cstddef>

#include "highfive/H5File.hpp"

#include "DataStructure/Input/Property/PBEAMData.h"

#include "DBManager/IRepository/Input/Property/IPBEAMRepository.h"
#include "DBManager/Repository/HDF5/Base/SingleRepositoryBase.h"

template <>
inline HighFive::DataType HighFive::create_datatype<SG::DataStructure::FEM::PBEAMData> ()
{
    HighFive::CompoundType compoundType = {
        { "PID", HighFive::create_datatype<SG::DataStructure::Common::I64> () },
        { "MID", HighFive::create_datatype<SG::DataStructure::Common::I64> () },
        { "NSEGS", HighFive::create_datatype<SG::DataStructure::Common::I64> () },
        { "CCF", HighFive::create_datatype<SG::DataStructure::Common::I64> () },
        { "CWELD", HighFive::create_datatype<SG::DataStructure::Common::I64> () },
        { "S0", HighFive::create_datatype<SG::DataStructure::Common::Real[11]> (), SG::DBManager::FIELD_SIZE, true },
        { "XXB", HighFive::create_datatype<SG::DataStructure::Common::Real[11]> (), SG::DBManager::FIELD_SIZE, true },
        { "A", HighFive::create_datatype<SG::DataStructure::Common::Real[11]> (), SG::DBManager::FIELD_SIZE, true },
        { "I1", HighFive::create_datatype<SG::DataStructure::Common::Real[11]> (), SG::DBManager::FIELD_SIZE, true },
        { "I2", HighFive::create_datatype<SG::DataStructure::Common::Real[11]> (), SG::DBManager::FIELD_SIZE, true },
        { "I12", HighFive::create_datatype<SG::DataStructure::Common::Real[11]> (), SG::DBManager::FIELD_SIZE, true },
        { "J", HighFive::create_datatype<SG::DataStructure::Common::Real[11]> (), SG::DBManager::FIELD_SIZE, true },
        { "NSM", HighFive::create_datatype<SG::DataStructure::Common::Real[11]> (), SG::DBManager::FIELD_SIZE, true },
        { "C1", HighFive::create_datatype<SG::DataStructure::Common::Real[11]> (), SG::DBManager::FIELD_SIZE, true },
        { "C2", HighFive::create_datatype<SG::DataStructure::Common::Real[11]> (), SG::DBManager::FIELD_SIZE, true },
        { "D1", HighFive::create_datatype<SG::DataStructure::Common::Real[11]> (), SG::DBManager::FIELD_SIZE, true },
        { "D2", HighFive::create_datatype<SG::DataStructure::Common::Real[11]> (), SG::DBManager::FIELD_SIZE, true },
        { "E1", HighFive::create_datatype<SG::DataStructure::Common::Real[11]> (), SG::DBManager::FIELD_SIZE, true },
        { "E2", HighFive::create_datatype<SG::DataStructure::Common::Real[11]> (), SG::DBManager::FIELD_SIZE, true },
        { "F1", HighFive::create_datatype<SG::DataStructure::Common::Real[11]> (), SG::DBManager::FIELD_SIZE, true },
        { "F2", HighFive::create_datatype<SG::DataStructure::Common::Real[11]> (), SG::DBManager::FIELD_SIZE, true },
        { "K1", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
        { "K2", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
        { "S1", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
        { "S2", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
        { "NSIA", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
        { "NSIB", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
        { "CWA", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
        { "CWB", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
        { "MIA", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
        { "M2A", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
        { "MIB", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
        { "M2B", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
        { "NIA", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
        { "N2A", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
        { "NIB", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
        { "N2B", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
        { "DOMAIN_ID", HighFive::create_datatype<SG::DataStructure::Common::I64> () },
    };
    return compoundType;
}
SG_DBMANAGER_HDF5_NAMESPACE_OPEN
class PBEAMRepository : public IPBEAMRepository, public SingleRepositoryBase<SG::DataStructure::FEM::PBEAMData>
{
  public:
    explicit PBEAMRepository (HDF5Database& database);

    void InitialDatasetInfo () override;
};
SG_DBMANAGER_HDF5_NAMESPACE_CLOSE
